/* =========================================================================
 *
 *   The traffic processor.
 *
 *   Development by Sedelnikov Alexander (Bigking).
 *
 * =========================================================================
 */

#ifndef __LOG_H__
#define __LOG_H__


#include "common.h"


#define  LOG_ID_LINE          1

#define  LOG_ID_MESSAGE       2

#define  LOG_ID_DEBUG         3

#define  LOG_ID_WARNING       4
#define  LOG_ID_ERROR         5
#define  LOG_ID_FATAL_ERROR   6


#define  _DEBUG


#ifdef   _DEBUG
#define  logdbg( ... ) journal::__log__( __FILE__, __LINE__, __PRETTY_FUNCTION__ ,LOG_ID_DEBUG , __VA_ARGS__ )
#else
#define  logdbg( ... )
#endif


#define  logline         journal::__log__( __FILE__, __LINE__, \
                             __FUNCTION__, LOG_ID_LINE, "" )
#define  logmsg( ... )   journal::__log__( __FILE__, __LINE__, \
                             __FUNCTION__, LOG_ID_MESSAGE, __VA_ARGS__ )
#define  logwrn( ... )   journal::__log__( __FILE__, __LINE__, \
                             __FUNCTION__, LOG_ID_WARNING, __VA_ARGS__ )
#define  logerr( ... )   journal::__log__( __FILE__, __LINE__, \
                             __FUNCTION__, LOG_ID_ERROR, __VA_ARGS__ )
#define  logfatal( ... ) journal::__log__( __FILE__, __LINE__, \
                             __FUNCTION__, LOG_ID_FATAL_ERROR, __VA_ARGS__ )


//-----------------------------------------------------------------------//
#define LOG_FILE "/var/log/trflog.log"


//-----------------------------------------------------------------------//
class journal
{


public:
    static void     __log__( const char *file,
                             const int   line,
                             const char *function,
                             const int   type,
                             const char *fmt, ... );


};


#endif
